﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="wfAgentDjackManage.aspx.cs" Inherits="msBsc.WebUi.wfAgentDjackManage" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>为代理添加地接客</title>
    <link href="/themes/wStyle1/css/sLayout.css" rel="stylesheet" />
    <link href="/themes/wStyle1/css/sHead.css" rel="stylesheet" />
    <link href="/themes/wStyle1/css/sFoot.css" rel="stylesheet" />
    <link href="/themes/wStyle1/css/usermenu.css" rel="stylesheet" />
    <link href="/themes/wStyle1/css/from.css" rel="stylesheet" />
    <link href="/jqPlugin/hdfu/hdfu.css" rel="stylesheet" />
    <link href="/themes/wStyle1/css/Seller/sReleaseForum.css" rel="stylesheet" />
    <link href="/jqPlugin/kindeditor/themes/default/default.css" type="text/css" rel="stylesheet" />
    <link href="/jqPlugin/layer/skin/layer.css" rel="stylesheet" />
    <style>
        .selArea {
            width: 140px;
            height: 30px;
            line-height: 30px;
            margin-right: 10px;
            font-family: 微软雅黑;
            font-size: 16px;
            color: #808080;
        }

        input[type=text] {
            width: 290px;
            height: 26px;
        }

        #btnSubmit {
            margin-left: 200px;
            margin-top: 20px;
            cursor: pointer;
            width: 140px;
            background-color: #3c93e8;
            color: #fff;
            line-height: 30px;
            border: 0;
            font-size: 16px;
            font-family: 微软雅黑;
        }

            #btnSubmit:hover {
                opacity: 0.8;
            }

        .notice {
            font-size: 14px;
            font-family: 微软雅黑;
            color: #f00;
            padding-left: 10px;
        }
    </style>
</head>
<body>
    <div class="wf_all">
        <input type="hidden" id="hidAgengId" value="" />
        <div class="main-container">
            <div class="main-Info">
                <div class="main-horizontal">
                    <div class="r_row">
                        <span class="control-span" style="width: 200px">姓名<span class="required">*</span></span>
                        <div class="controls">
                            <input type="text" id="txtDjkName" disabled="disabled" value="" placeholder="请输入地接客姓名" /><span class="notice"></span>
                        </div>
                    </div>
                    <div class="r_row">
                        <span class="control-span" style="width: 200px">所属地区<span class="required">*</span></span>
                        <div class="controls">
                            <select class="selArea" disabled="disabled" id="selCountry">
                                <option value="0">请选择</option>
                                <option value="DF6723BE-A25C-4F77-BB49-A1662D3E6F2A">中国</option>
                                <option value="453370FE-8295-41EC-A41C-B6F650AD1B4C">亚洲</option>
                                <option value="927D5F28-C4FB-46A9-940C-B07DF0A04018">北美洲</option>
                                <option value="1FEAF456-7C76-41C8-A3D0-F9C12415A736">南美洲</option>
                                <option value="4E2B4524-E9CB-4E20-9224-E58EB636D1C7">非洲</option>
                                <option value="67FA6A8D-951C-4B53-AE1E-70DCB97E11DE">欧洲</option>
                                <option value="0B772F3D-D8F8-42E3-9019-81FE6F772236">大洋洲</option>
                            </select>
                            <select class="selArea" disabled="disabled" id="selCity">
                                <option value="0">请选择</option>
                            </select>
                            <xmp id="country_city_list" style="display: none">
                                <option value="0">请选择</option>
            {{#for(var i=0,len=d.rows.length;i < len;i++){ }}
                   <option value="{{d.rows[i].COUNTRY_CITY_ID}}">{{d.rows[i].COUNTRY_CITY_NME}}</option>
            {{#} }}        
            </xmp>
                            <select class="selArea" disabled="disabled" id="selDestination">
                                <option value="0">请选择</option>
                            </select><span class="notice areaNotice"></span>
                            <xmp id="city_des_list" style="display: none">
                                    <option value="0">请选择</option>
            {{#for(var i=0,len=d.rows.length;i < len;i++){ }}
                   <option value="{{d.rows[i].COUNTRY_CITY_ID}}">{{d.rows[i].COUNTRY_CITY_NME}}</option>
            {{#} }}
            </xmp>


                        </div>
                    </div>
                    <div class="r_row">
                        <span class="control-span" style="width: 200px">联系电话<span class="required">*</span></span>
                        <div class="controls">
                            <input type="text" disabled="disabled" id="txtPhone" value="" placeholder="请输入地接客联系电话" /><span class="notice"></span>
                        </div>
                    </div>
                    <div class="r_row">
                        <span class="control-span" style="width: 200px">服务区域<span class="required">*</span></span>
                        <div class="controls">
                            <input type="text" id="txtServiceArea" disabled="disabled" value="" placeholder="请输入地接客服务区域" /><span class="notice"></span>
                        </div>
                    </div>
                    <div class="r_row">
                        <span class="control-span" style="width: 200px">QQ号码</span>
                        <div class="controls">
                            <input type="text" id="txtTencentQQ" disabled="disabled" value="" placeholder="请输入地接客QQ号码" />
                        </div>
                    </div>
                    <div class="r_row">
                        <span class="control-span" style="width: 200px">微信账号</span>
                        <div class="controls">
                            <input type="text" id="txtWechatNo" disabled="disabled" value="" placeholder="请输入地接客微信账号" />
                        </div>
                    </div>
                    <div class="r_row">
                        <div class="controls">
                            <input type="button" disabled="disabled" id="btnSubmit" value="确认提交" />
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!--start JS引用-->
    <script src="/jqPlugin/js/jquery-1.8.3.min.js"></script>
    <script src="/jqPlugin/js/jBase.js"></script>
    <script src="/jqPlugin/js/jBPage.js"></script>
    <script src="/jqPlugin/js/laytpl.js"></script>
    <script src='/??jqPlugin/kindeditor/kindeditor.js,jqPlugin/kindeditor/lang/zh_CN.js'
        type='text/javascript'></script>
    <script src="/themes/wStyle1/js/comm/VerifyJs.js"></script>

    <script src="/jqPlugin/SelectSimu/js/SelectSimu.js"></script>
    <script src="/themes/wStyle1/js/comm/jsLayout.js"></script>
    <!--end JS引用-->

    <script type="text/javascript">
        $(function () {
            //获取代理信息
            var agentId = GetQueryStr("agentid");

            //判断代理信息是否为空
            if (!IsNull(agentId)) {
                $("#hidAgengId").val(agentId);
                $("input,select").removeAttr("disabled");
            }

            SetAreaInfo();
        })

        //设置地区联动信息
        function SetAreaInfo() {
            $("#selCountry").change(function () {
                $("#selCity").html("<option value='0'>请选择</option>");
                $("#selDestination").html("<option value='0'>请选择</option>");
                var _opartParam = new jsonRow();
                _opartParam.AddCell("countryId", $("#selCountry").val());
                _opartParam.AddCell("cityId", $("#selCity").val());
                _opartParam.AddCell("ACTION", "changeArea");
                ajaxComm(_opartParam);
            })

            $("#selCity").change(function () {
                $("#selDestination").html("<option value='0'>请选择</option>");
                var _opartParam = new jsonRow();
                _opartParam.AddCell("cityId", $("#selCity").val());
                _opartParam.AddCell("ACTION", "changeArea");
                ajaxComm(_opartParam);
            })
        }

        //提交填写好的信息
        $("#btnSubmit").click(function () {
            var djkName = $("#txtDjkName").val();
            if (IsNull(djkName)) {
                ShowErrMsg("txtDjkName", "地接客姓名不能为空");
                return;
            }

            var countryId = $("#selCountry").val();
            var cityId = $("#selCity").val();
            var desId = $("#selDestination").val();

            if (countryId == "0"
                || cityId == "0"
                || desId == "0") {
                ShowErrMsg("selDestination,#selCountry,#selCity", "地区信息不能为空");
                return;
            }

            var telPhone = $("#txtPhone").val();
            if (IsNull(telPhone)) {
                ShowErrMsg("txtPhone", "地接客联系电话不能为空");
                return;
            }

            var serviceArea = $("#txtServiceArea").val();
            if (IsNull(serviceArea)) {
                ShowErrMsg("txtServiceArea", "地接客服务区域不能为空");
                return;
            }

            var tencentQQ = $("#txtTencentQQ").val();
            var weChatNo = $("#txtWechatNo").val();

            var opart = new jsonRow();
            opart.AddCell("countryId", countryId);
            opart.AddCell("cityId", cityId);
            opart.AddCell("destinationId", desId);
            opart.AddCell("djkName", djkName);
            opart.AddCell("telPhone", telPhone);
            opart.AddCell("serviceArea", serviceArea);
            opart.AddCell("tencentQQ", tencentQQ);
            opart.AddCell("weChatNo", weChatNo);
            opart.AddCell("AgentId", $("#hidAgengId").val());
            opart.AddCell("ACTION", "AddNewDjk");


            if (confirm("确定添加账号[" + telPhone + "]为地接客？")) {
                $(this).attr("disabled", "disabled");
                ajaxComm(opart, null, function () {
                    $("#btnSubmit").removeAttr("disabled");
                });
            }

        })

        //显示错误提示信息
        /*
        * targetId:发生错误的标签的Id
        * msgStr:错误提示信息
        */
        function ShowErrMsg(targetId, msgStr) {
            $("#" + targetId).css("border-color", "#f00").siblings(".notice").text(msgStr);

            $("#" + targetId).change(function () {
                $(this).css("border", "2px inset").siblings(".notice").text("");
            })
        }
    </script>
</body>
</html>
